package com.foreknow.elmboot.mapper;

import com.foreknow.elmboot.po.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CartMapper {

    public List<Cart> listCart (Cart cart);

    @Insert("insert into cart(foodId,businessId,userId,quantity) values(#{foodId},#{businessId},#{userId},1) ")
    public int saveCart (Cart cart);

    @Update("update cart set quantity=#{quantity} where userId=#{userId} and businessId=#{businessId} and foodId=#{foodId}")
    public int updateCart (Cart cart);

    public int removeCart(Cart cart);

}
